#!/bin/bash
set -e
# rm -rf build
os=$(uname)
if [ "$os" = "Linux" ]; then
    cmake -B build -DUNIT_TEST=ON
elif [[ "$os" == *"MINGW"* ]]; then
    export LOCAL_CXX_LIBS_PATH=D:/Coding/Local_Libs
    if [ ! -d $LOCAL_CXX_LIBS_PATH ];then
        echo LOCAL_CXX_LIBS_PATH:$LOCAL_CXX_LIBS_PATH not exist
        exit 1
    fi
    cmake -B build -G"MinGW Makefiles" -DUNIT_TEST=ON
else
    echo "unknown os"
    exit 1
fi

cmake --build build -j$(nproc)
# ctest --test-dir build -V
ctest --test-dir build
